<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
</head>

<body>
  <div id="app">
    <!-- slotProps插槽对象 -->
    <my-cpn>
      <div slot="languages" slot-scope="slotProps">
        {{slotProps.data.join('-')}}
      </div>
    </my-cpn>
  </div>

  <template id="myCpn">
      <div>
        <slot :data="pLanguages" name="languages">
          <ul>
            <li v-for="item in pLanguages" :key="item">{{item}}</li>
          </ul>
        </slot>
      </div>
    </template>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script>
    const app = new Vue({
      el: "#app",
      data: {
        message: "hello",
      },
      components: {
        myCpn: {
          template: "#myCpn",
          data() {
            return {
              pLanguages: ["JavaScript", "Python", "Swift", "Go", "C++"],
            };
          },
        },
      },
    });
  </script>
</body>

</html>